//
//  ILCarListTableViewCell.m
//  ILife
//
//  Created by lanou on 15/10/26.
//  Copyright © 2015年 ILife. All rights reserved.
//

#import "ILCarListTableViewCell.h"

@implementation ILCarListTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        CGFloat width = SCREEN_WIDTH  / 3;
        CGFloat height = SCREEN_WIDTH / 4;
        _picImageView = [[UIImageView alloc] initWithFrame:CGRectMake(5, 5, width, height)];
        
        _titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(width + 10, 0, SCREEN_WIDTH - width - 10, SCREEN_HEIGHT / 11)];
  
        _originLabel = [[UILabel alloc] initWithFrame:CGRectMake(width + 10, height - 5, 60, 10)];
        _originLabel.textAlignment = NSTextAlignmentLeft;
        _originLabel.font = [UIFont systemFontOfSize:12];
        
        _timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(SCREEN_WIDTH - 70, height - 5, 60, 10)];
        _timeLabel.font = [UIFont systemFontOfSize:12];
        _timeLabel.textAlignment = NSTextAlignmentRight;
        
        _readCountLabel = [[UILabel alloc] initWithFrame:CGRectMake(width + 75, height - 5, 80, 10)];
        _readCountLabel.textAlignment = NSTextAlignmentLeft;
        _readCountLabel.font = [UIFont systemFontOfSize:12];
        
        [self.contentView addSubview:_picImageView];
        [self.contentView addSubview:_titleLabel];
        [self.contentView addSubview:_originLabel];
        [self.contentView addSubview:_timeLabel];
        [self.contentView addSubview:_readCountLabel];
    }
    return self;
    
}

- (void)setListModel:(ILCarListModel *)listModel {
    [_picImageView sd_setImageWithURL:[NSURL URLWithString:listModel.picUrlList] placeholderImage:[UIImage imageNamed:@"ilife"]];
    _titleLabel.text = listModel.title;
    _titleLabel.numberOfLines = 0;
    _originLabel.text = listModel.origin;
    _timeLabel.text = listModel.publishTime;
    _readCountLabel.text = [@"阅读:"stringByAppendingString:listModel.readCount];
}






- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
